<template>
    <div>

        <h1>商城首页</h1>
        <el-row >
          <el-col :span="8" v-for="(o, index) in prdList" :key="o" :offset="index > 0 ? 2 : 2" style="width: 800px;height: auto;float: left">
            <el-card :body-style="{ padding: '0px' }" style="width:800px">
              <div style="padding: 20px;">
                <span v-text="o.labelName"></span>
                <span v-text="o.price"></span>
                <div class="bottom clearfix">
                  <el-button type="text" class="button" @click="shop(o.tid)">详情</el-button>
                </div>
              </div>
            </el-card>
          </el-col>
        </el-row>

    </div>
</template>

<script>
    export default {
        name: "Index",
        data() {
            return {
                prdList:{},
            }
        },
        created() {
            this.$http.post("product/product/selectAll").then(response => {
                this.prdList=response;
            })
        },
        methods:{
            shop(tid){
                this.$router.replace({name: 'xq', query: {tid:tid}})
            }
        }
    }
</script>

<style scoped>
  .el-col-offset-0 {
    margin-left: 0;
  }
</style>
